package com.onec.service.manage.controller;

import com.onec.service.api.annotation.RestfulControllerLog;
import com.onec.service.api.dto.request.BaseRequest;
import com.onec.service.api.dto.response.BaseResponse;
import com.onec.service.api.enums.ResultCodeEnum;
import com.onec.service.manage.service.redisLock.RedisLickService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ONEC
 * @since 2018-10-22
 */
@Slf4j
@ApiOperation(value = "redis 分布式锁测试")
@RestController
public class RedisLockController extends BaseController {

    private static final Logger LOGGER = LoggerFactory.getLogger(RedisLockController.class);

    @Autowired
    private RedisLickService redisLickService;

    /**
     * 验证登陆页面
     *
     * @return
     */
    @RestfulControllerLog(name = "aop 分布式锁")
    @RequestMapping(value = "/addClock", method = RequestMethod.POST, produces = {"application/json; charset=UTF-8"})
    public BaseResponse addClock(@RequestBody BaseRequest baseRequest) {
        redisLickService.addClock();
        return BaseResponse.error(ResultCodeEnum.SUCCESS);
    }


}
